$words = explode(" ", "Community College District"); $acronym = ""; foreach ($words as $w) { $acronym .= $w[0]; }